function c = simcost(type, bandwidth, components)

arglist = [type ' ' num2str(bandwidth)];
for c = components
  arglist = [arglist ' ' c.type ' ' num2str(c.freq) ' ' num2str(c.mem) ' ' ...
	     num2str(c.bandwidth)];
end
  
[status, result] = system(['/home/wcaarls/src/sc/dse/simcost.py ' ...
		    arglist]);

if status ~= 0
  disp('Cost simulation failed');
  disp(result);
  c = 0;
  return
end

start = strfind(result, '% *** CUT HERE ***');
eval(result(start:end));
